﻿<html>
<head><title>.:: VNews - Tin tức tận tay ::.</title>
<link rel="stylesheet" type="text/css" href="css/style.css" />
<script type="text/javascript" src="jquery/jquery-1.8.1.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Language" content="UTF-8" />
<meta name="viewport" content="width=320; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta names="apple-mobile-web-app-status-bar-style" content="black-translucent" />
	<script language="javascript">
	$(document).ready(function() {
		jQuery.ajax({
				url:"http://buminta.pro/Vnews/service/login.php",
				xhrFields: {
				withCredentials: true
				},
				success: function (data){
					console.log(data);
					var user_info = JSON.parse(data);
					console.log(user_info);
					if(user_info==''||user_info.result.status!=true){
						alert('Bạn chưa đăng nhập');
						$(window.location).attr('href', 'login.htm');
					}
				}
			});
		jQuery.ajax({
				url: "http://buminta.pro/Vnews/data/RSS.xml",
				success: function(xml) {
					console.log(xml);
					var rss = $(xml).find('item:first');
					var title = rss.find('title').text();
					var id = rss.find('iD').text();
					$('#center').append('<div class="bt"><div class="news-title">'+title+'</div><input type="image" src="images/news-tt.png" class="news-bt" onClick="window.location=\'news-tt.htm\'"><input type="image" src="images/view.png" class="bt-view" onClick="load(\''+id+'\')"></div>');
					console.log(title);
				}
			});
			jQuery.ajax({
				url: "http://buminta.pro/Vnews/data/RSS.xml",
				success: function(xml) {
					console.log(xml);
					var rss = $(xml).find('item:first');
					var title = rss.find('title').text();
					var id = rss.find('iD').text();
					$('#center').append('<div class="bt"><div class="news-title">'+title+'</div><input type="image" src="images/news-pl.png" class="news-bt" onClick="window.location=\'news-pl.htm\'"><input type="image" src="images/view.png" class="bt-view" onClick="load(\''+id+'\')"></div>');
					console.log(title);
				}
			});
			jQuery.ajax({
			url: "http://buminta.pro/Vnews/data/RSS.xml",
				success: function(xml) {
					console.log(xml);
					var rss = $(xml).find('item:first');
					var title = rss.find('title').text();
					var id = rss.find('iD').text();
					$('#center').append('<div class="bt"><div class="news-title">'+title+'</div><input type="image" src="images/news-tg.png" class="news-bt" onClick="window.location=\'news-tg.htm\'"><input type="image" src="images/view.png" class="bt-view" onClick="load(\''+id+'\')"></div>');
					console.log(title);
				}
			});
			jQuery.ajax({
			url: "http://buminta.pro/Vnews/data/RSS.xml",
				success: function(xml) {
					console.log(xml);
					var rss = $(xml).find('item:first');
					var title = rss.find('title').text();
					var id = rss.find('iD').text();
					$('#center').append('<div class="bt"><div class="news-title">'+title+'</div><input type="image" src="images/news-xh.png" class="news-bt" onClick="window.location=\'news-xh.htm\'"><input type="image" src="images/view.png" class="bt-view" onClick="load(\''+id+'\')"></div>');
					console.log(title);
				}
			});
			jQuery.ajax({
			url: "http://buminta.pro/Vnews/data/RSS.xml",
				success: function(xml) {
					console.log(xml);
					var rss = $(xml).find('item:first');
					var title = rss.find('title').text();
					var id = rss.find('iD').text();
					$('#center').append('<div class="bt"><div class="news-title">'+title+'</div><input type="image" src="images/news-kd.png" class="news-bt" onClick="window.location=\'news-kd.htm\'"><input type="image" src="images/view.png" class="bt-view" onClick="load(\''+id+'\')"></div>');
					console.log(title);
				}
			});
			jQuery.ajax({
			url: "http://buminta.pro/Vnews/data/RSS.xml",
				success: function(xml) {
					console.log(xml);
					var rss = $(xml).find('item:first');
					var title = rss.find('title').text();
					var id = rss.find('iD').text();
					$('#center').append('<div class="bt"><div class="news-title">'+title+'</div><input type="image" src="images/news-vh.png" class="news-bt" onClick="window.location=\'news-vh.htm\'"><input type="image" src="images/view.png" class="bt-view" onClick="load(\''+id+'\')"></div>');
					console.log(title);
				}
			});
		})
	</script>
</head>
<body>
	<div id="footer">
		<input type="image" src="images/backBtn.png" class="backBtn" onClick="logout()">
		<div class="text-news">Tin tức</div>
	</div>
	<div id="center">
	</div>
	<script language="javascript">
		function logout(){
			jQuery.ajax({
					type:"POST",
					data:{
						'logout': true,
					},
					url:"http://buminta.pro/Vnews/service/login.php",
					success: function (data){
						console.log(data);
						var user_info = JSON.parse(data);
						console.log(user_info);
						if(user_info.result.status!=true){
							alert('Đăng xuất thành công');
							 $(window.location).attr('href', 'login.htm');
						}
					}
			});
		}
	</script>
</body>
</html>
